using System.ComponentModel.DataAnnotations;
using UniversalAdmin.Shared.Enums;

namespace UniversalAdmin.Application.DTOs;

// 权限数据传输对象
public record PermissionDto(
    Guid Id,
    string Name,
    string? Description,
    string Resource,
    string Action,
    PermissionType Type,
    int SortOrder,
    bool IsEnabled
);

// 创建权限数据传输对象
public record CreatePermissionDto(
    [Required, MaxLength(50)] string Name,
    string? Description,
    [Required, MaxLength(50)] string Resource,
    [Required, MaxLength(50)] string Action,
    PermissionType Type = PermissionType.Function,
    int SortOrder = 0,
    bool IsEnabled = true
);

// 更新权限数据传输对象
public record UpdatePermissionDto(
    [Required, MaxLength(50)] string Name,
    string? Description,
    [Required, MaxLength(50)] string Resource,
    [Required, MaxLength(50)] string Action,
    PermissionType Type,
    int SortOrder,
    bool IsEnabled
);

// 权限树节点DTO
public record PermissionTreeDto(
    Guid Id,
    string Name,
    string? Description,
    string Resource,
    string Action,
    PermissionType Type,
    int SortOrder,
    bool IsEnabled
);

// 角色权限分配DTO
public record RolePermissionAssignmentDto(
    Guid RoleId,
    List<Guid> PermissionIds
);